<template>
  <div class="home-new">
    <HomePanell title="服饰" :sub-title="goods">
      <template #right>
        <XtxMore path="/" />
      </template>
      <!-- 面板内容 -->
      <footer class="footer" ref="FuShi">
        <div class="img">
          <img :src="obj1.picture" alt="">
        </div>
        <!-- {{obj1.picture}} -->
        <footer class="box">
          <ul class="goods-list" v-for="item in obj" :key="item.id">
            <RouterLink to="/" class="image">
              <img src="" alt="" v-lazy="item.picture"/>
            </RouterLink>
            <p class="name ellipsis-2">{{item.name}}</p>
            <p class="desc">{{item.desc}}</p>
            <p class="price">&yen;{{item.price}}</p>
            <div class="extra">
              <RouterLink to="/">
                <span>找相似</span>
                <span>发现现多宝贝 &gt;</span>
              </RouterLink>
            </div>
          </ul>
        </footer>
      </footer>
    </HomePanell>
  </div>
</template>
    <script>
import HomePanell from './HomePanell.vue'
import XtxMore from './xtx-more.vue'
import { getGoods } from '@/utils/api/homeapi'
import {lazyload} from '@/utils/constfun'
export default {
  components: { HomePanell, XtxMore },
  data() {
    return {
      goods: [],
      obj: {},
      obj1: {}
    }
  },
  methods: {
    async getlist() {
      let res = await getGoods()
      // console.log(res);
      this.goods = res.result[2].children
      this.obj = res.result[2].goods
      this.obj1 = res.result[2].goods[6]
      // console.log(this.goods);
      // console.log(this.obj);
      // console.log(this.obj1);
    }
  },
  mounted() {
    // this.getlist()
    lazyload(this.$refs.FuShi,this.getlist)
  },
}
</script>
    
<style lang="scss" scoped>
@import "@/assets/css/components.scss";
@import "@/assets/css/color.scss";
.footer {
  display: flex;
  flex-wrap: wrap;
  .img {
    width: 240px;
    height: 610px;
    // background: red;
    > img {
      width: 100%;
      height: 100%;
    }
  }
}
.box {
  width: 990px;
  height: 610px;
  display: flex;
  flex-wrap: wrap;
}
.goods-list {
  width: 240px;
  height: 300px;
  padding: 10px 30px;
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
  transition: all 0.5s;
  .image {
    display: block;
    width: 160px;
    height: 160px;
    margin: 0 auto;
    img {
      width: 100%;
      height: 100%;
    }
  }
  p {
    margin-top: 6px;
    font-size: 16px;
    &.name {
      height: 44px;
    }
    &.desc {
      color: #666;
      height: 22px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    &.price {
      margin-top: 10px;
      font-size: 20px;
      color: $priceColor;
    }
  }
  .extra {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 86px;
    width: 100%;
    background: $xtxColor;
    text-align: center;
    transform: translate3d(0, 100%, 0);
    transition: all 0.5s;
    span {
      display: block;
      color: #fff;
      width: 120px;
      margin: 0 auto;
      line-height: 30px;
      &:first-child {
        font-size: 18px;
        border-bottom: 1px solid #fff;
        line-height: 40px;
        margin-top: 5px;
      }
    }
  }
  &:hover {
    border-color: $xtxColor;
    .extra {
      transform: none;
    }
  }
}
</style>